﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DatabaseBackUp.aspx.cs" Inherits="RegisterWeb.Manager.SystemManager.DatabaseBackUp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
      <link href="../../css/main.css" rel="stylesheet" type="text/css" />
    <link href="../../js/jquery-easyui-1.2.6/themes/gray/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../../js/jquery-easyui-1.2.6/themes/icon.css" rel="stylesheet" type="text/css" />
    <script src="../../js/jquery-easyui-1.2.6/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="../../js/jquery-easyui-1.2.6/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../js/jquery-easyui-1.2.6/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {

            $("#backupPosition").val("D:/beifen");

            $("#backupPosition").click(function () {
                $("#backupPosition").focus(function () {
                    $("#warn").text("如D:/beifen");
                }).blur(function () {
                    $("#warn").text("");

                });
            });
        });
        function BackupDatabase() { 
           
            var operateDatabase = $("#operateDatabase").combobox('getValue');
            var backupPosition = $("#backupPosition").val();
            if (operateDatabase == null || operateDatabase == "") {
                $.messager.show({ title: '提示', msg: '请选择备份数据库!' });
            }
            if (backupPosition == null || backupPosition == "") {
                $.messager.show({ title: '提示', msg: '请填写备份位置!' });
            }
            if (operateDatabase != null && operateDatabase != "" && backupPosition != null && backupPosition != "") {
                $.post('ashx/SystemPersonHandler.ashx?action=backup', { action: 'backup', operateDatabase: operateDatabase.toString(), backupPosition: backupPosition.toString() }, function (data, status) {
                    if (data == "ok") {
                        $.messager.show({ title: '备份提示', msg: '备份数据成功!' });
                    }
                    else { $.messager.show({ title: '备份提示', msg: '备份数据失败!' }); }

                });
            }
        }
        function reset() {
            $("#operateDatabase").combobox('setValue', '');
            $("#backupPosition").val("");
        }
    </script>
</head>
<body>
    <form id="addPro"  method="post">
    <div class="ftitle">备份数据库</div>
   <div class="fitem">
    <label>操作数据库：</label>
      <select id="operateDatabase" name="operateDatabase"   style="width:150px;"  required="true">
     </select>
 
     <script type="text/javascript">

         $('#operateDatabase').combobox({

             url: 'ashx/SystemPersonHandler.ashx?action=database',
             valueField: 'Database_Id',
             textField: 'Database_Name',
             panelHeight: "auto"
         });
             
        </script>
    </div>
      <div class="fitem">
    <label>备份位置：</label>
    <input type="text" name="backupPosition" id="backupPosition" class="easyui-validatebox" required="true"  /><span class="error" id="warn"></span>
    </div>
       <div id="buttons">
             &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;  &nbsp;&nbsp; &nbsp;&nbsp;
				<a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="BackupDatabase()">备份数据库</a>
				<a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="reset()">重&nbsp;置</a>
  </div>
    </form>
</body>
</html>
